How to pass json data which is sourced from ajax post request via a service into jQuery DataTable 您所在的位置:网站首页 jquery ajax data How to pass json data which is sourced from ajax post request via a service into jQuery DataTable

How to pass json data which is sourced from ajax post request via a service into jQuery DataTable

2023-02-19 00:34| 来源: 网络整理| 查看: 265

I have an asp.net webforms appication in it I have an HTML table which is getting populated via ajax call sourced by a service, I want to convert the table into jQuery DataTable and source the data to the datatable but couldn't get it done and over click it is throwing 2 errors in alert (1) is "DataTables warning: table id=tblnotificationlogHistory - Ajax error. For more information about this error, please see http://datatables.net/tn/7" and (2) is "DataTables warning: table id=tblnotificationlogHistory - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3". Code: ``` jQuery(".statusname, .commentsHistory").click(function (event) { debugger; var callForCommHistory = (jQuery(this).attr("class") == 'commentsHistory'); var ccrsflattenId = jQuery(this).next('._ccrsflattenId').text(); var FlattenExtID = jQuery(this).next('._ccrsflattenId').next('._FlattenExtID').text(); var webMethod = '/Service/CRService.asmx/GetUnmatchedHistoryStatuses' var parameters = "{ccrsflattenId: " + ccrsflattenId + " , FlattenExtID: " + FlattenExtID + " , isCallForCommHistory: " + callForCommHistory + "}"; console.log('parameters: ' + parameters); showLoader(); jQuery.noConflict(); jQuery(".tblnotificationlogHistory").DataTable({ paging: false, searching: false, info: false, processing: true, serverside: true, "ajax": { "type": "POST", "url": "webMethod", "data": "parameters", "contentType": "application/json; charset=utf-8", "dataType" : "json" }, "columns": [ { "data": "createdDate" }, { "data": "comments" }, { "data": "updatedby" } ] }); });



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有